package com.quickly.develop.common.commonExport;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/***
 * ExportTitleSetUtil: 导出数据字段及表头配置文件 BEAN
 * 
 *
 */
public class ExportConfigUtil {

	public static void main(String[] args) {
		ExportBeanVo beanVo = testExportBeanVo();
		HashMap<String, String> hashMap = columnTitleToHashMap(beanVo.getColumnList());
		System.out.println(hashMap.toString());
	}

	/**
	 * testColumnBeans : 测试excel导出使用的表头列字段，表头文字（）
	 * 
	 * @return
	 */
	public static ExportBeanVo testExportBeanVo() {
		List<ExportColumnBean> columnList = new ArrayList<>();
		columnList.add(new ExportColumnBean("title1", "title列1"));
		columnList.add(new ExportColumnBean("title2", "title列2"));
		columnList.add(new ExportColumnBean("title3", "title列3"));
		ExportBeanVo beanVo = new ExportBeanVo("测试excel文档", "测试sheet页", "测试title表头", columnList, null);
		return beanVo;
	}

	// ====================================================
	/**
	 * columnTitleToHashMap : 将表格title列表转为map
	 * 
	 * @return
	 */
	public static HashMap<String, String> columnTitleToHashMap(List<ExportColumnBean> columnTitleList) {
		HashMap<String, String> hashMap = new HashMap<>();
		for (ExportColumnBean bean : columnTitleList) {
			hashMap.put(bean.getColumn(), bean.getValue());
		}
		return hashMap;
	}
}
